class: center, middle, inverse, title-slide # Visualizing Activity Data from Wearable Devices in R to Create Personalized Activity Reports ## Duke Industry Statistics Symposium ### Stefan Avey, Principal Scientist, Janssen R&D ### 23 Apr 2021 --- # Disclaimer - The views presented in these slides are my own and do not necessarily reflect the position of my company (Johnson & Johnson). - All data displayed in this presentation are anonymized, sample, or simulated actigraphy data. ??? - Give some background on me personally to fill in the bio, if needed --- # Fatigue and Sleep Disturbance are Prevalent Symptoms - Digital health technologies, such as activity trackers, may provide a novel way to measure impacts of fatigue and sleep disturbances in patients with chronic immune diseases. <img src="include/fatigue_sleep_ideafast.png"> ??? - Prevalence in many chronic immune-mediated inflammatory diseases is above 50% for fatigue and sleep disturbance - New tools are needed to understand the real impact of these symptoms on patient's daily lives. - This schematic is taken from one of those initiatives, the IMI-funded project IDEA-FAST (Identifying Digital Endpoints of Fatigue and Sleep Disturbance) --- # Introduction to Actigraphy .pull-left[ - Actigraphy is a **non-invasive** method of monitoring human rest/activity patterns through monitoring of **movement**. - Often, a small wrist-watch with a built-in **accelerometer** is used to collect **actigraphy** data. - Example derived data include: step count, time in intense physical activity, sleep time. <img src="include/actigraph_cpiw.jpeg" height="250"> <img src="include/actiwatch2.png" height="200"> ] .pull-right[ <img src="include/cpiw_activity_count_traces.png"> ] ??? - Actigraphy watches have accelerometers which measure movement in 3 axes (x, y, z) - What's shown on the right is a summarized "activity count" which summarizes the amount of movement detected by the accelerometer in 1 minute **epochs** over a full 24-hour day. --- # Why Create Personalized Activity Reports? - We want to **provide value** to study participants with the data we are already collecting - Study participants expect it from consumer wearables. - Typically the data collected in clinical trials is not shared with study participants (prevent unblinding, prevent biasing patient-reported data, QC'ed data not available in real-time) <center> <img src="include/consumer_dashboards.png" height="325"> </center> ??? - We wanted to provide value while also making sure we... - Prevent biasing data - Ensure data privacy - Increase patient engagement (drive better compliance) --- # Automated Creation of Activity Reports with Shiny - Internal Shiny app was built to interactively create participant reports <center> <img src="include/shiny_dashboard.png" height = "400"> </center> ??? - Semi-Automated Workflow - Export Data from ActiGraph (actigraphy vendor's) dashboard - Upload data file into Shiny app - Select months and participants - Download a batch of activity reports - Transferred from Janssen to the virtual site to add to participant app/web portal. - Workflow could be automated by pulling data from the vendor's API. --- # Activity Report in Phase 0 Study .left-column[ - Ongoing Phase 0 Observational Study including a research-grade actigraphy watch - Built a report and process for data sharing **during the study** - Static PDF report with activity/sleep summary metrics - Providing a report per participant per month ] .right-column[ <img src="include/activity_report_tiles.png" height="450"> ] ??? - Screenshot here shows the first page of the mock report which was delivered as a monthly summary. - Initially had grand plans of making this like consumer-facing app but due to limitations with technology we were using we could not integrate directly into the study mobile app or use HTML / interactive plots. - Had to use static PDF summaries available via the study mobile app or online dashboard as downloads --- # Activity Report in Phase 0 Study .left-column[ - Report is built using Rmarkdown and rendering to PDF - All visualizations are created using R code ] .right-column[ <img src="include/code_tiles.png"> .center[For more details, see [my answer on Stack Overflow](https://stackoverflow.com/questions/47105282/valuebox-like-function-for-static-reports/56841865#56841865)] ] ??? - Create the tiles with `geom_tile()` using the `color` column - Add the numeric values as text in `value` column - Add the labels for each box stored in the `info` column - Use `geom_text()` to add the icons by specifying the unicode symbol. --- # Example Plot in Activity Report .left-column[ - Daily plots of step count, sleep time, and time spent in moderate-to-vigorous physical activity (MVPA) ] .right-column[ <img src="include/activity_report_steps.png" height="450"> ] ??? - Snapshot of average of the daily values for the entire month in calendar-like layout - Given only after study participants complete the daily and weekly patient reported outcomes. - A disclaimer was included: "This information in this report is for informational purposes only and not to be considered as medical advice. This information is not intended to diagnose, prescribe, treat, or cure any medical condition..." --- # Example Plot in Activity Report .left-column[ - R code to generate daily bar charts. ] .right-column[ <img src="include/code_step_plot.png"> ] ??? - The code for this plot is very simple in ggplot2 consisting of mainly `geom_bar()` and `geom_text` calls. --- # Future Directions - Towards Interactivity - Actigraphy data is rich in density (monthly, weekly, daily, minute-level, etc.) and can be displayed in many different ways. - More research is needed to understand the best way to visualize the data and what data study participants want to see. - Interactive graphics are currently being explored as a way for the study team to engage with the data. - Interactive graphics could also be a way to engage participants who really want to understand their data - Drilling down into intra-day data - Understanding changes in weekly summary statistics over time --- # Beautiful Visualizations .left-column[ - Visualization of 4 months of sleep times in a newborn. - Blue represents sleep times on a 24-hour clock with each ring representing 1 day. ] .right-column[ <img src="include/circular_sleeping_patterns.png" height="450"> source: <a href="https://www.reddit.com/r/dataisbeautiful/comments/5l39mu/my_daughters_sleeping_patterns_for_the_first_4/dbskzid/" target="_blank">Redditor andrew_elliott</a> ] ??? - Daughter's sleeping patterns in the first 4 months of her life. One continuous spiral starting on the inside when she was born, each revolution represents a single day. - Could imagine something like this being very interesting and beautiful and published in a scientific journal but not so much for general consumption. Just a pretty picture to most people. --- # Interactives - Doughnut Charts ```r act_df %>% plot_ly(labels = ~Type, values = ~fraction) %>% add_pie(hole = 0.5) %>% layout(showlegend = TRUE, xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE), yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE)) ```
??? - Doughnut chart is just like a pie chart with a hole in it - Way to show percent of time spent in different (mobility) states - Click around to show they are interactive and not static --- # <!-- NOTE: Update the dashboard to turn off the legend in doughnut plot --> <!-- Can actually include the dashboard itself but doesn't render well --> <iframe src="include/patient_dashboard.html" height="600" width = "1000"></iframe> <!-- <\!-- Show a screenshot of the dashboard instead -\-> --> <!-- <center> --> <!-- <img src="include/dashboard_screenshot.png" height="500"> --> <!-- </center> --> ??? - Full blown dashboards can be created as HTML files and... - Can host this on patient community portal - Or can send as a standalone HTML file that allows patients to explore the data - We are currently working to understand what our study participants would want to see --- # Summary - Inclusion of digital health tools, such as actigraphy, are increasingly used in clinical trials to better understand patient's activity, sleep, and activities of daily living. - If we want to increase voluntary participation, compliance, and engagement we should in my opinion provide some data back to study participants - Need to think carefully about how to do this depending the study objective (during or after study, what type of data is understandable , etc.) - Showed an example of how we have **visualized actigraphy data** to create **personalized activity reports** using an **interactive shiny dashboard** in a phase 0 study. - Future work will improve upon these reports as we learn what information study participants want to see and as we leverage new technologies for sharing data with study participants. ??? - In addition to using the data for research, that data can be summarized in a way that is value for study participants.